package net.bolue.sysmng.console;

import java.util.List;
import java.util.Map;

import net.bolue.sysmng.db.DBMetaManager;
import net.bolue.sysmng.db.metadata.TblMetaData;
import net.bolue.sysmng.exception.BolueException;
import net.bolue.sysmng.model.TblInfoModel;
import net.bolue.sysmng.tblbean.TblInfo;

public class MetaDataAdmin {

	public List<TblMetaData> getTblList(String subSys, String catalog, String schema)throws BolueException{
		List<TblMetaData> tblList = DBMetaManager.getAllTables(subSys, null, null);
		TblInfoModel tblInfoModel = new TblInfoModel();
		Map<String,TblInfo> tblMap = tblInfoModel.getTblInfoMap(subSys);
		for(int i=0;i<tblList.size();i++){
			TblMetaData tblMetaData = tblList.get(i);
			String tableName = tblMetaData.getTableName();
			TblInfo tblInfo = tblMap.get(tableName);
			if(tblInfo!=null){
				tblMetaData.setRemarks(tblInfo.getTblDesc());
			}
		}
		return tblList;
	}
}
